#include "display_manager.h"

DisplayManager::DisplayManager(const vector<SmartCar> cars) {
    this->m_cars = cars;
    this->index = 0;
}

void DisplayManager::display() {
    char c;
    displayByIndex(this->index);
    while (true) {
        cin >> c;
        if (c == 'n') {
            if (this->index >= 9) {
                cout << "没有最后了！！" << endl;
            } else {
                displayByIndex(++this->index);
            }
        } else if (c == 'p') {
            if (this->index <= 0) {
                cout << "没有前面了！！" << endl;
            } else {
                displayByIndex(--this->index);
            }
        } else if (c == 'q') {
            cout << "退出显示" << endl;
            break;
        }
    }
}

void DisplayManager::displayByIndex(int pos = 0) {
    cout << "***************************************" << endl;
    auto car = this->m_cars[pos];
    cout << "姓名：" << car.stuName << endl;
    cout << "学号：" << car.stuId << endl;
    cout << "小车编号：" << car.id << endl;
    cout << "\t底盘：" << endl;
    cout << "\t\t编号：" << car.chassisId << endl;
    cout << "\t\t型号：" << car.chassisModel << endl;
    cout << "\t\t轴距：" << car.wheelBase << endl;
    cout << "\t\t轮距：" << car.trackWidth << endl;
    cout << "\t\t最小离地间隙：" << car.groundClearance << "mm" << endl;
    cout << "\t\t最小转弯半径：" << car.turningRadius << "m" << endl;
    cout << "\t\t驱动形式：" << car.driveType << endl;
    cout << "\t\t轮胎" << car.tireCount << "个：" << endl;
    cout << "\t\t\t型号：" << car.tireModel << endl;
    cout << "\t\t\t尺寸：" << car.tireSize << "mm" << endl;
    cout << "\tAGX套件：" << car.agxCount << "套" << endl;
    cout << "\t\t型号：" << car.agxModel << endl;
    cout << "\t\tAI：" << car.aiPerformance << endl;
    cout << "\t\tCUDA 核心：" << car.cudaCores << endl;
    cout << "\t\ttensor 核心：" << car.tensorCores << endl;
    cout << "\t\t显存：" << car.gpuMemorySize << endl;
    cout << "\t\t内存：" << car.memorySize << endl;
    cout << "\t双目摄像头：" << car.cameraCount << "个" << endl;
    cout << "\t\t型号：" << car.cameraModel << endl;
    cout << "\t\t摄像头：" << car.cameraType << endl;
    cout << "\t\tRGB分辨率：" << car.resolutionWidth << "*" << car.resolutionHeight << endl;
    cout << "\t\tRGB帧率：" << car.rgbFrameRate << endl;
    cout << "\t\tFOV：" << car.fovWidth << "*" << car.fovHeight << endl;
    cout << "\t\t深度摄像头帧率：" << car.depthFrameRate << endl;
    cout << "\t激光雷达：" << car.lidarCount << "个" << endl;
    cout << "\t\t型号：" << car.lidarModel << endl;
    cout << "\t\t通道数：" << car.lidarChannelCount << endl;
    cout << "\t\t测试范围：" << car.lidarRange << "m" << endl;
    cout << "\t9轴陀螺仪：" << car.gyroscopeCount << "个" << endl;
    cout << "\t\t型号：" << car.gyroscopeModel << endl;
    cout << "\t\t厂家：" << car.gyroscopeVendor << endl;
    cout << "\t液晶显示屏：" << car.displayCount << "个" << endl;
    cout << "\t\t尺寸：" << car.displaySize << endl;
    cout << "\t\t型号：" << car.displayModel << endl;
    cout << "\t电池模块：" << car.batteryCount << "个" << endl;
    cout << "\t\t参数：" << car.batteryParams << endl;
    cout << "\t\t对外供电：" << car.supplyVoltage << endl;
    cout << "\t\t充电时长：" << car.chargingTime << endl;
}
